<?php
namespace app\indexLogin\model;
use think\Db;
use think\Model;

class  Store extends Model{
    protected $table='wb_store';
    protected $pk='sid';

    /**
     * 添加收藏
     */
    public  function  add($data){
        if(Db::table('wb_store')->where('uid','=',$data['uid'])->where('wid','=',$data['wid'])->select()){
            return ['valid'=>0,'msg'=>'已经收藏过了'];
        }else{
            $res=$this->save($data);
            return ['valid'=>$res,'msg'=>'收藏成功'];
        }
    }
}